備份數(shù)據(jù)庫
mysqldump -u root -p --all-databases > c:\all_databases_back.sql
(2) 通過命令mysql實(shí)現(xiàn)數(shù)據(jù)還原
mysql -u root -p company < c:\t_dept_back.sql
(3) 實(shí)現(xiàn)數(shù)據(jù)庫表導(dǎo)出到文本文件
執(zhí)行SELECT...INTO OUTFILE實(shí)現(xiàn)導(dǎo)出到文本文件
?select *
? ? ? ? ? from t_dept
? ? ? ? ? into outfile 'c:/t_dept.txt';
?
# 格式化
select *
? ? ? ? ?from t_dept
? ? ? ? ?into outfile 'c:/t_dept.txt'
? ? ? ? ?fields terminated by '\、'
? ? ? ? ?optionally enclosed by '\"'
? ? ? ? ?lines starting by '\>'
? ? ? ? ?terminated by '\r\n';
執(zhí)行命令mysql實(shí)現(xiàn)導(dǎo)出到文本文件
mysql -u root -proot -e"select * from t_dept" company > c:/t_dept.txt